package com.sdx.console.base.service;

import java.util.List;

import com.ibeetl.admin.core.entity.BaseEntity;
import org.beetl.sql.core.engine.PageQuery;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.sdx.console.base.dao.BaseUnivDao;
import com.sdx.console.base.entity.BaseUniv;
import com.ibeetl.admin.core.service.BaseService;

/**
 * 院校 Service
 */

@Service
@Transactional
public class BaseUnivService extends BaseService<BaseUniv>{

    @Resource
	private BaseUnivDao baseUnivDao;

    public PageQuery<BaseUniv>queryByCondition(PageQuery query){
        PageQuery ret =  baseUnivDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelBaseUniv(List<String> ids){
        try {
            baseUnivDao.batchDelBaseUnivByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除院校失败", e);
        }
    }

    public List<BaseEntity> selectProvince(){
        return baseUnivDao.selectProvince();
    }

    public List<BaseEntity> selectCityByProvId(Integer provinceId){
        return baseUnivDao.selectCityByProvId(provinceId);
    }

	public List<BaseUniv> all() {
		return baseUnivDao.all();
	}

	public BaseUniv selectBaseUnivById(Integer univId){
        return baseUnivDao.selectBaseUnivById(univId);
    }

    public void updateBaseUnivById(Integer univId,String columnName,Integer columnValue){
        baseUnivDao.updateBaseUnivById(univId,columnName,columnValue);
    }

}